<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业物联网转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
declare (strict_types=1);

namespace app\listener\property;

use app\common\repositories\property\users\PropertyUsersRepository;
use app\common\repositories\property\users\PropertyUsersLogRepository;

class LogoutSuccess
{
    /**
     * 事件监听处理
     *
     * @return mixed
     */
    public function handle($propertyUserInfo)
    {
        /** @var PropertyUsersRepository $repository */
        $repository = app()->make(PropertyUsersRepository::class);
        $repository->clearSessionInfo();
        /**  @var PropertyUsersLogRepository $logRepository */
        $logRepository = app()->make(PropertyUsersLogRepository::class);
        $logRepository->addInfo($propertyUserInfo['property_id'], $propertyUserInfo['user_id'], 'LOGOUT');
    }
}
